install.packages(c("DT", "knitr"))
---
title: "Diamond sizes"
date: 2016-08-25
output: html_document
---
```{r setup, include = FALSE}
library(ggplot2)
library(dplyr)
library(ggplot2)
library(dplyr)
smaller <- diamonds %>%
filter(carat <= 2.5)
smaller %>%
ggplot(aes(carat)) +
geom_freqpoly(binwidth = 0.01)
library(ggplot2)
library(dplyr)
smaller <- diamonds %>%
filter(carat <= 2.5)
rm(list=ls())
setwd("/Users/yasenov/Dropbox (IPL)/RefugeeBan/Data")
varnames = c("state", "year", "origin", "city", "refugees")
####
####
data1 = read.csv("WRAPS/MX %2D Arrivals by Destination and Nationality.csv", skip = 3, header = TRUE)
data1 = data[1:79812, ]
data1 = subset(data1, select = c("nat_definition4", "region_name_3", "Category3", "Assur_DestinationCity1", "Cases3"))
colnames(data1) <- varnames
data1$year = substr(data1$year,4 ,8)
data1$year = as.numeric(data1$year)
data1$refugees = as.numeric(data1$refugees)
head(data1)
summary(data1)
####
####
data2 = read.csv("WRAPS/MX %2D Arrivals by Destination and Nationality.csv", skip = 3, header = TRUE)
data2 = data[79813:length(data2$Textbox87), ]
data2 = subset(data2, select = c("nat_definition4", "region_name_3", "Category3", "Assur_DestinationCity1", "Cases3"))
colnames(data2) <- varnames
data2$year = substr(data2$year,4 ,8)
data2$year = as.numeric(data2$year)
data2$refugees = as.numeric(data2$refugees)
summary(data2)
head(data2)
####
####
data = rbind(data1, data2)
summary(data)
rm(data1, data2)
dim(data)
head(data)
data3 = read.csv("crime/crime_for_R.csv", header = TRUE)
colnames(data3)
data4 = subset(data3, select = c("ori", "year", "fips_state_county_code"))
df[,grep("actual_", names(df))]
data3[,grep("actual_", names(df))]
data5=data3[,grep("actual_", names(data3))]
head(data5)
data3 = read.csv("crime/crime_for_R.csv", header = TRUE)
data4 = subset(data3, select = c("ori", "year", "fips_state_county_code"))
data5=data3[,grep("actual_", names(data3))]
data3 = cbind(data4, data5)
colnames(data3)
